/*
 * NodeIteratorImp.h
 *
 *  Created on: Apr 28, 2009
 *      Author: wrice
 */

#ifndef NODEITERATORIMP_H_
#define NODEITERATORIMP_H_
#include "DOMCoreImp.h"
namespace DOMCoreImp {

class NodeIteratorImp : IMPLEMENTS( NodeIterator ){
protected:
	friend class DocumentImp;
	NodeIteratorImp(
			Node * root,
			unsigned long whatToShow,
			NodeFilter * filter,
			bool entityReferenceExpansion);

public:
	virtual Node * getRoot();
	virtual unsigned long getWhatToShow();
	virtual NodeFilter * getFilter();
	virtual bool getExpandEntityReferences();

	virtual Node * nextNode() throw(DOMExceptionPtr);
	virtual Node * previousNode() throw(DOMExceptionPtr);
	virtual void detach();

public: // new methods
	static Node * getNextNode( Node * from, Node * root, unsigned long whatToShow,
			NodeFilter * const nodeFilter, bool isRejected );
	static Node * getPreviousNode( Node * from, Node * root, unsigned long whatToShow,
			NodeFilter * const nodeFilter, bool isRejected );
	static unsigned long acceptNodeForWhatToShow( unsigned long whatToShow, Node * node );

private:
	Node * root_;
	unsigned long whatToShow_;
	NodeFilter * filter_;
	bool entityReferenceExpansion_;

	Node * referenceNode_;
	bool isPositionBeforeReferenceNode_; // or after

	struct Imp;
};

}

#endif /* NODEITERATORIMP_H_ */
